﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
enum player
{
    admin,user
}
namespace db_de
{
    public partial class Login : Form
    {
        public Login()
        {
            InitializeComponent();
        }
        player login_person = player.user;
        private void Login_Load(object sender, EventArgs e)
        {
            login_person = player.user;
            panel1.BackColor = panel2.BackColor;

            int x_6 = (panel2.Width - label6.Width)/2;
            int y_6 = (panel2.Height - label6.Height)/2;
            int x_5 = (panel3.Width - label5.Width) / 2;
            int y_5 = (panel3.Height - label5.Height) / 2;

            label6.Location = new Point(x_6, y_6);
            label5.Location = new Point(x_5, y_5);
        }

        private void label1_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        private void label2_Click(object sender, EventArgs e)
        {

        }

        private void label5_Click(object sender, EventArgs e)
        {
            panel3_Click(sender, e);
        }

        private void label4_Click(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            switch (login_person)
            {
                case player.user:
                    {
                        if (true)
                        {

                            user_window user_w = new user_window();
                            this.Hide();
                            user_w.ShowDialog();
                            this.Dispose();
                        }
                        break;
                    }
                    case player.admin:
                    {


                        if (true)
                        {
                            admin_window user_w = new admin_window();
                            this.Hide();
                            user_w.ShowDialog();
                            this.Dispose();
                        }
                        break;
                    }
                default:
                    {
                        break;
                    }
            }
        
            
        }
        
        private void button2_Click(object sender, EventArgs e)
        {
            MessageBox.Show("等待设计");
        }

        private void panel3_Paint(object sender, PaintEventArgs e)
        {

        }

        private void panel3_Click(object sender, EventArgs e)
        {
            login_person = player.admin;
            panel1.BackColor = panel3.BackColor;
            
        }

        private void panel2_Click(object sender, EventArgs e)
        {
            login_person = player.user;
            panel1.BackColor = panel2.BackColor;
            
        }

        private void label6_Click(object sender, EventArgs e)
        {
            panel2_Click(sender, e);
        }

        private void textBox2_TextChanged(object sender, EventArgs e)
        {

        }
    }
}
